Learn R Programming

gtfsio (version 1.2.0)

[.gtfs: Subset a GTFS object

Description

Subsetting a GTFS object using [ preserves the object class.

Usage

# S3 method for gtfs
[(x, value)

Value

A GTFS object.

Arguments

x

A GTFS object.

value

Either a numeric or a character vector. Designates the elements to be returned.

Examples

Run this code
gtfs_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")

gtfs <- import_gtfs(gtfs_path)
names(gtfs)
class(gtfs)

small_gtfs <- gtfs[1:5]
names(small_gtfs)
class(small_gtfs)

small_gtfs <- gtfs[c("shapes", "trips")]
names(small_gtfs)
class(small_gtfs)

Run the code above in your browser using DataLab